package com.hd.pzhwlxt.controller.model4;

import com.hd.pzhwlxt.pojo.Trans;
import com.hd.pzhwlxt.service.TransService;
import com.hd.pzhwlxt.utils.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @create: 2022-09-26 21:26
 * @author: 怀念天空
 * @Description:
 */
@RestController
public class VehicleTransInfoController {


    @Autowired
    private TransService transService;

    @GetMapping("/vehicleTransInfo/{id}")
    private Response<Object> getVehicleTransInfo(@PathVariable Integer id){

        List<Trans> trans = transService.getTransInfoByVehicleId(id);
        if (trans!= null){
            return Response.createSuccessResponse("查询成功",trans);
        }
        return Response.createErrorResponse("查询失败");
    }

    //查询铁路专线的订单信息
    @GetMapping("/trainWay/{id}")
    public Response<Object> getUsedTrainWayById(@PathVariable Integer id){
        List<Trans> trans = transService.getTrainWayByRouteId(id);
        if (trans!=null){
            return Response.createSuccessResponse("查询成功",trans);
        }
        return Response.createErrorResponse("查询失败");
    }
}
